
var EXPORTED_SYMBOLS = ["SynoLoaderDMS"];


if (typeof SynoLoaderDMS == "undefined") {
  var SynoLoaderDMS = {};
   

SynoLoaderDMS = {

		 syno_download_station : new function() {
		
			this.SynoId=0;
			this.initialized=false;
			this.list=[];
			
			
			this.url="none";
			

			this.connect_to_nas= function(link) 
		       {
		       	SynoLoaderDMS.DMS_Connect.url=this.url + '/webman/login.cgi';
		       	SynoLoaderDMS.DMS_Connect.setParameter();
				SynoLoaderDMS.DMS_Connect.send();
			
			}; 	
		
			this.transfer_to_nas = function(link){

				if(link.indexOf("ed2k://")!=-1)
				{
					
					SynoLoaderDMS.DMS_SendEmuleLink.url=this.url + this.getDownloadStationEmulUrl();
			       	SynoLoaderDMS.DMS_SendEmuleLink.setParameter(link);
					SynoLoaderDMS.DMS_SendEmuleLink.send();
				}
				else
				{

					SynoLoaderDMS.DMS_SendLink.url=this.url + this.getDownloadStationUrl();
			       	SynoLoaderDMS.DMS_SendLink.setParameter(link);
					SynoLoaderDMS.DMS_SendLink.send();
				}
		
			};
		
			this.GetAll = function(){
				SynoLoaderDMS.DMS_GetAllEmule.url=this.url + this.getDownloadStationEmulUrl();
				SynoLoaderDMS.DMS_GetAll.url=this.url + this.getDownloadStationUrl();
				SynoLoaderDMS.DMS_GetAllEmule.send();
				SynoLoaderDMS.DMS_GetAll.send();
				
		
			};
			
			
			this.getlist = function()
			{
				var list = [];
				var getall_list = SynoLoaderDMS.DMS_GetAll.getlist();
				var getallemule_list = SynoLoaderDMS.DMS_GetAllEmule.getlist();
				for (x in getall_list) {list.push(getall_list[x]); };
				for (x in getallemule_list) {list.push(getallemule_list[x]); };
				SynoLoaderDMS.Util.log(JSON.stringify(list, ':'));
				return list;
			};

			this.getDownloadStationUrl = function()
			{ 
				if(this.DSMVerison=="3")
					return '/webman/modules/DownloadStation/dlm/downloadman.cgi';
				if(this.DSMVerison=="4")
					return '/webman/3rdparty/DownloadStation/dlm/downloadman.cgi';
			};
			
			this.getDownloadStationEmulUrl = function()
			{ 
				if(this.DSMVerison=="3")
					return '/webman/modules/DownloadStation/aMuleUI/dl_queue.cgi';
				if(this.DSMVerison=="4")
					return '/webman/3rdparty/DownloadStation/aMuleUI/dl_queue.cgi';
			};
		}
	};
 };		
 
 Components.utils.import("resource://SynoLoader/Util.js",SynoLoaderDMS); 
 Components.utils.import("resource://SynoLoader/DMS_Commando/DMS_GetAll.js",SynoLoaderDMS); 
 Components.utils.import("resource://SynoLoader/DMS_Commando/DMS_Connect.js",SynoLoaderDMS); 
 Components.utils.import("resource://SynoLoader/DMS_Commando/DMS_SendLink.js",SynoLoaderDMS); 
 Components.utils.import("resource://SynoLoader/DMS_Commando/DMS_TaskAktion.js",SynoLoaderDMS);
 Components.utils.import("resource://SynoLoader/DMS_Commando/DMS_SendEmuleLink.js",SynoLoaderDMS);
 Components.utils.import("resource://SynoLoader/DMS_Commando/DMS_GetAllEmule.js",SynoLoaderDMS);
 Components.utils.import("resource://SynoLoader/Notification.js",SynoLoaderDMS); 
